import React from 'react'
import {
    View,
    Text,
    ImageBackground,
    StyleSheet,
    Image,
    TextInput
} from 'react-native'
import { TouchableOpacity } from 'react-native-gesture-handler';
import '../../common/global'
import { AsyncStorage } from 'react-native';

const Log = ({navigation}) => {

    const [value, onChangeText] = React.useState('');

    const saveData = async (data) => {
        data = JSON.stringify(data);
        await AsyncStorage.setItem(
            'qianming',data
        );
    }
    return (
        <View style={{ backgroundColor: 'white', height: h, paddingLeft: 20, paddingRight: 20, paddingTop: 30 }}>
            <View style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center' }}>
                <TextInput
                    style={{ height: 200, backgroundColor: 'rgb(249,249,251)', borderRadius: 10 }}
                    onChangeText={text => onChangeText(text)}
                    value={value}
                    placeholder='说点什么吧' multiline={true} numberOfLines={4}
                />
                <TouchableOpacity style={{ marginTop: 20, backgroundColor: 'rgb(20,158,255)', height: 40, display: 'flex', justifyContent: 'center', alignItems: 'center', borderRadius: 10 }}
                    onPress = {()=>{
                        saveData(value);
                        navigation.navigate('mine');
                    }}>
                    <Text style={{ color: 'white', fontSize: 16 }}>保存</Text>
                </TouchableOpacity>
            </View>

        </View>
    )
}
const styles = StyleSheet.create({

})
export default Log
